#ifndef LIBRARY_H
#define LIBRARY_H

#include <QObject>
#include <QMutex>
#include <QWaitCondition>
#include <QList>
#include "Book.h"

class Library : public QObject
{
	Q_OBJECT
	int maxBooksNumber;
	int booksNumber;
	int freeBooksNumber;
	QMutex mutex;

	QList<Book*> books;

public:
	explicit Library(int maxBooksNumber, QObject *parent = 0);
	int getFreeBooksNumber();
	int addBook();
	bool hasEmptySlots();
	int getAnyBook();
	void returnBook(int bookId);
	void reserveSlot();
	void getBook(int bookId);
	
signals:
	void freeBooksNumberChanged(int newBooksNumber);
	void freeBook(int id);
	void readBook(int id);
	void editBook(int id);
	void activate();
	void deactivate();
	
public slots:
	
};

#endif // LIBRARY_H
